<?php

class Application_Form_Login extends Zend_Form {

	public function init() {
		$this->setMethod('post');
		$this->setAction('/user/login');

		// Поле login
		$this->addElement('text', 'login', array(
			'label' => 'Ваш login',
			'required' => true,
			'filters' => array(
				'StringTrim'
			),
			'validators' => array(
				array('StringLength',
					array(
						'min' => 1,
						'max' => 32
					)
				)
			)
		));

		// Поле password
		$this->addElement('password', 'password', array(
			'label' => 'Ваш password:',
			'required' => true,
			'filters' => array('StringTrim'),
			'validators' => array(
				array('StringLength',
					array(
						'min' => 1,
						'max' => 32
					)
				)
			)
		));

		// Каптча
		$this->addElement('captcha', 'captcha', array(
			'label' => 'Введите символы с картинки:',
			'required' => true,
			'captcha' => array(
				'captcha' => 'Image',
				'font' => APPLICATION_PATH . '/../public/fonts/arial.ttf',
				'fontSize' => '30',
				'height' => '50',
				'width' => '144',
				'imgDir' => APPLICATION_PATH . '/../public/img/captcha',
				'imgUrl' => '/img/captcha',
				'wordLen' => 5,
				'timeout' => 300
			)
		));

		// Чекбокс запомнить
		$this->addElement('checkbox', 'remembermy', array(
			'ignore' => true,
			'label' => 'Зпомнить меня'
		));

		// Кнопка войти
		$this->addElement('submit', 'submit', array(
			'ignore' => true,
			'label' => 'Войти',
		));

		// Защита CSRF
		$this->addElement('hash', 'csrf', array(
			'ignore' => true,
		));
	}

}